# -*- encoding: utf-8 -*-
'''
@File    :   main.py
@Time    :   2020/09/23 18:39:30
@Author  :   Wicos 
@Version :   1.0
@Contact :   wicos@wicos.cn
@Blog    :   https://www.wicos.me
'''

# here put the import lib
import pandas as pd
import os


class Tower(object):
    def __init__(self):
        self.root = os.getcwd()
        if self.select_system() == 0:
            self.root = self.root.replace('\\','/')
        self.select_number = 1
        self.file_list = []
        self.show_file()

    def select_system(self):
        if os.name == 'nt':
            return 0
        if os.name == 'posix':
            return 1

    def show_file(self):
        xp = []
        for i in os.listdir():
            if os.path.splitext(i)[1] == '.xlsx':
                xp.append(i)
        if len(xp) > 0:
            self.file_list = xp
            for x in xp:
                print("{}，{}".format(xp.index(x)+1,x))
            self.select_number = int(input("请输入原始需求的文件序号(默认为1号)："))
        else:
            print("请检查您是否将原始文件放在本文件夹下！")

    def read_file(self):
        if len(self.file_list) > 0:
            self.file = pd.read_excel(self.root + "/" + self.file_list[self.select_number - 1])
            self.data = pd.DataFrame(self.file)
            print(self.data.columns)

a = Tower()
a.read_file()